package com.ftf.tp.common.constants;

import com.ftf.tp.common.core.exception.BusinessException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 点赞
 *
 * @author tanghao
 */
@Getter
@AllArgsConstructor
public enum SupportTypeEnum {

    /**
     * 点赞
     */
    ARTICLE_SUPPORT("article", "support:article"),

    ;

    final String type;

    final String tag;

    public static String topicByType(String type) {
        for (SupportTypeEnum supportTypeEnum : SupportTypeEnum.values()) {
            if (supportTypeEnum.getType().equals(type)) {
                return supportTypeEnum.getTag();
            }
        }

        throw new BusinessException("未找到对应的code=" + type);
    }
}
